package org.chatboleh.util;

import javax.print.attribute.Size2DSyntax;
import javax.print.attribute.standard.MediaSize;

public class InchToPoint {
/**
 * Consider every point is 1/72 of an inch.
 */
	private static Size2DSyntax size;
	
	public InchToPoint(){
		size = new MediaSize(0,0,Size2DSyntax.INCH);
	}
	
	public static int convert(double d){
		size = new MediaSize((float) d,(float) d,Size2DSyntax.INCH);
		return (int) (size.getX(Size2DSyntax.INCH) * 72);
	}
	
	public static int convertMM(double d){
		size = new MediaSize((float) d,(float) d,Size2DSyntax.MM);
		return (int) (size.getX(Size2DSyntax.INCH) * 72);
	}

}
